package com.ken.astroboy.util;

public class Exceptions {

    /** 
     * 获取exception详情信息 
     *  
     * @param e 
     *            Excetipn type 
     * @return String type 
     */  
    public static String getExceptionDetail(Exception e) {  
  
        StringBuffer msg = new StringBuffer("null");  
  
        if (e != null) {  
            msg = new StringBuffer("");  
  
            String message = e.toString();  
  
            int length = e.getStackTrace().length;  
  
            if (length > 0) {  
  
                msg.append(message + "\n");  
  
                for (int i = 0; i < length; i++) {  
  
                    msg.append("\t" + e.getStackTrace()[i] + "\n");  
  
                }  
            } else {  
  
                msg.append(message);  
            }  
  
        }  
        return msg.toString();  
  
    }  
    
}
